<template>
	<view :class="[primarySize()]">
		<view class="container">
			<view class="p30">
				<view class="detail_item">
					<view class="flex-box">
						<view class="describe_tit flex-grow-1">企业评价<text class="fs28 col6 pl30 fn"></text></view>
					</view>
					<view>
						<view class="appraise_item" v-for="(item,index) in comments">
							<view class="flex-box">
								<view class="header_img">
									<image :src="cdnurl(item.user.avatar)" mode="aspectFill"></image>
								</view>
								<view class="flex-grow-1">
									<view class="flex-box">
										<view class="m-ellipsis pr30 flex-grow-1">{{item.user.nickname}}</view>
										<view class="star_img">
											<image src="@/static/public/star-on.png" mode="aspectFit"
												v-for="(item,index) in parseInt(item.avg_score)"></image>
										</view>
									</view>
								</view>
							</view>
							<view class="clearfix ptb20" v-if="item.tags_text.length>0">
								<view class="welfare_item" v-for="tag in item.tags_text">{{tag}}</view>
							</view>
							<view class="fs26 col3">{{item.content}}</view>
						</view>

						<view class="nothing" v-if="commentsMore.nothing">
							<image src="@/static/public/icon_nothing.png" mode="aspectFit"></image>
							<text>暂无评论信息</text>
						</view>
						<view class="g-btn3-wrap" v-else>
							<view class="g-btn3" @click="fetch()">{{commentsMore.text}}</view>
						</view>

					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const app = getApp();
	export default {
		data() {
			return {
				
				companyId: 0,
				comments: [],
				commentsMore: {
					page: 1
				}
			}
		},
		onReady() {
			uni.setNavigationBarColor({
				frontColor: '#ffffff',
				backgroundColor: this.primaryColor()
			})
		},
		onLoad(options) {
			
			this.companyId = options.id || 0
			this.fetch();
		},
		onReachBottom() {
			this.fetch();
		},
		methods: {
			fetch() {
				this.$util.fetch(this, 'xilujob.company_comment/lists', {
					company_id: this.companyId,
					pagesize: 10
				}, 'commentsMore', 'comments', 'company_comments',data=>{
					return data;
				});
			},
		}
	}
</script>

<style lang="scss" scoped>
	.detail_item {
		padding: 30rpx;
		width: 690rpx;
		background: #FFFFFF;
		box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.03);
		border-radius: 18rpx;
	}

	.describe_tit {
		position: relative;
		font-size: 32rpx;
		color: #000;
		font-weight: bold;
		margin-bottom: 15rpx;
	}

	.describe_text {
		line-height: 54rpx;
		font-size: 26rpx;
		color: #333333;
	}

	.describe_tit::after {
		content: '';
		position: absolute;
		left: 0;
		bottom: 0;
		width: 136rpx;
		height: 17rpx;
		background: var(--primary);
		opacity: 0.3
	}

	.describe_tit.tit1 {
		margin: 0 0 30rpx;
		font-size: 36rpx;
	}

	.describe_tit.tit1::after {
		width: 149rpx;
		height: 14rpx;
		border-radius: 7rpx;
		background: #0167D2;
		opacity: 0.3
	}

	.fs28 {
		font-size: 28rpx
	}

	.fs26 {
		font-size: 26rpx
	}

	.header_img {
		width: 72rpx;
		height: 72rpx;
		margin-right: 20rpx;
	}

	.header_img image {
		width: 100%;
		height: 100%;
		display: block;
		border-radius: 50%;
	}

	.star_img image {
		width: 29rpx;
		height: 27rpx;
		display: inline-block;
		vertical-align: middle;
		margin-left: 9rpx;
	}

	.welfare_item {
		font-size: 20rpx;
		color: #999;
		float: left;
		border-radius: 8rpx;
		line-height: 39rpx;
		background-color: #F7F7F7;
		margin-right: 20rpx;
		padding: 0 15rpx;
		box-sizing: border-box
	}

	.ptb20 {
		padding: 20rpx 0;
	}

	.appraise_item {
		padding: 30rpx 0;
		border-bottom: 1rpx solid #F3F3F3
	}

	.appraise_item:nth-last-child(1) {
		padding-bottom: 0;
		border-bottom: 0
	}
</style>